Fixing the demo to not provoque ctrl actions with modded keyboards or mobile virtual keyboards#879
Conversation
|
@belug23 Can you open a separate Issue for this? I do agree we have a bug here, just not with the proposed fix. It just "happens to work" with this patch, but it looks like the library and the backend are both fighting over who should be handling this, and in the long run it will most likely break again. |
This comment was marked as outdated.
This comment was marked as outdated.
|
As discussed in #882 I've updated the code to handle the release of the special functions. |
There was a problem hiding this comment.
Just note that I still don't consider this to be exactly correct, and it should NOT be merged yet. There are many nuances mentioned about this issue in #882 We decided to update this PR in order to have something to work with.
RobLoach
left a comment
There was a problem hiding this comment.
Thanks for the review. This logic always catches me.
While using a modded keyboard with macros on the characters pressing the keys affected by the ctrl modifier without ctrl down, would still trigger it, it was the same issue using the Android virtual keyboard.
Here's an example of what was happening, pressing
awould erase all text and write the letterainstead, pressingbwould write the letterbat the start of the text area and set the cursor in between the first and second character, pressingewould add the lettereat the end of the text area.After some code investigation, I found out that calling
nk_input_keywould always increasectx->input.keyboard.keys[key].clickedeven ifctrlwasn't push, then if it was released while the clicked counter was still equals to 1, it would increase it to 2 triggering thenk_input_key_presseddue to the validation ofif ((k->down && k->clicked) || (!k->down && k->clicked >= 2)).Only calling
nk_input_keywhenctrlis down fixes the problem.